<%@page contentType="text/html; charset=utf-8" %>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<%@ include file="/commons/commonEdit.jsp" %>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>物品归还</title>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">
function addThingGiveback(){
	var isTrue=$('thingGivebackForm').fireEvent("onSubmit") ;
    if(isTrue){
        var param = Form.serialize('thingGivebackForm');
        var url = null;
		url = "${ctx}/thing_thingEntrustAction.do?method=addThingGiveback";
        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResult});
	}
}
function showResult(response){
    ajaxSubmitException(response.responseText);
	var obj = findFrame('thingEntrustBaseMain');
	obj.reloadThingEntrust();
	windowClose();
}
function openChooseAssessor(){
	 	 var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain";
	  	 url += "&frameName=thingGiveback";
	  	 url += "&callBack=setHandover";
	  	 url += "&multiple=false";
		 top.windowOpen(url, "selectPerson", "选人", 530, 700,true,"selectPerson");
}
function setHandover(info){
		var onePerson= new Array();
	    onePerson=info.split(";");
	    for (i=0;i<onePerson.length ;i++ )
	    {
	     var oneAttribute= new Array();
	     oneAttribute=onePerson[i].split(",");
		 $('givebackMan').value=oneAttribute[1];
		 $('givebackMan').fireEvent("onblur");
		}
}
</script>
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">物品归还</span> </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td colspan="2" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color">
          <form action="" method="post" name="thingGivebackForm" class="required-validate">
          <input type="hidden" name="thingEntrustId" value="${thingEntrustId }">
          <input type="hidden" name="keyword" value="${thingGiveback.keyword }">
          <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
           <tr >
            <td class="aux_intable_td1">归还人：</td>
             <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
               <tr>
                 <td><input name="givebackMan" type="text" readonly="readonly" class="required" value="${thingGiveback.givebackMan }" size="16" maxlength="36"/></td>
                 <td width="4">&nbsp;</td>
                 <td><a href="#"  onClick="openChooseAssessor();" onFocus="this.blur()"><img src="${ctx}/images/ico_cz.gif" width="16" height="16" border="0" /></a></td>
               </tr>
             </table></td>
             </tr>
           <tr >
             <td class="aux_intable_td1">归还日期：</td>
             <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td>
                   <input id="acceptDate" name="acceptDate" value="${acceptDate}" type="hidden"><!-- 接收日期 -->
                   <input name="givebackDate" type="text" class="required validate-date-yyyy-MM-dd  great-equals-than-acceptDate" value="<fmt:formatDate value='${thingGiveback.givebackDate }' pattern='yyyy-MM-dd'/>" validateMessageGreatEquals="应大于或等于接收日期"  afterInsert="givebackDateSpan"  size="16" maxlength="10"/></td>
                   <td width="4">&nbsp;</td>
                   <td><img name="givebackDateButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" /><span id="givebackDateSpan"></span> </td>
                 </tr>
             </table></td>
           </tr>
		   <tr >
            <td class="aux_intable_td1">接受人：</td>
             <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
               <tr>
                 <td><input name="accepter" type="text" class="required validate-char" value="${thingGiveback.accepter }" size="16" maxlength="36"/></td>
                 <td width="4">&nbsp;</td>
                 <td></td>
               </tr>
             </table></td>
             </tr>
           <tr id="tr03">
            <td valign="top" class="aux_intable_td1">备 注：</td>
            <td valign="top" class="aux_intable_td2"><textarea name="description" cols="29" rows="2" class="max-length-200">${thingGiveback.description }</textarea></td>
            </tr>
        </table></form></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="window_footer">&nbsp;</td>
    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table border="0" cellpadding="0" cellspacing="0" onclick="addThingGiveback();">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22"  onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onblur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
          <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td class="buttonOffLeft" id="btn1_31"></td>
                <td class="buttonOffMiddle" id="btn1_32" onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
                <td class="buttonOffRight" id="btn1_33"></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
</table>
<script type="text/javascript">
Calendar.setup(
              {
	              inputField : "givebackDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "givebackDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
</script>
</body>
</html>